#ifndef _widetools_h_
#define _widetools_h_

// widetools.h
//
// Wide (i.e. Unicode related) tools

#include <string>

namespace simple{
    //
    // WideTools
    //

    class WideTools
    {
    public:
        static WideTools& gOnly ();

        enum eBOM { eUnknownEndian=0, eLittleEndian=1, eBigEndian=2};

        wchar_t bom () const { return 0xfeff;}
        // The byte-order mark to determine endian-ness

        eBOM endian () const { return _endian;}
        // Returns endian-ness of the system

        eBOM checkBOM (wchar_t value) const;
        // Checks the value to see if it is little or big endian.
        // little endian = (0xff 0xfe). Big endian = (0xfe 0xff)
        // The BOM is 0xfeff and is written to the start of files

        wchar_t       swap (wchar_t value);
        unsigned long swap (unsigned long value);
        void          swap (std::wstring& value);    // Done in place
        // Swap endian-ness of a value, or string

    private:
        static WideTools* _sOnly;

        eBOM _endian;                    // Our endian type

        WideTools ();
    };

}
#endif // _widetools_h_
